<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="价格方案" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="addData()"
                        ng-disabled="!btnPermission.priceSchemeAdd"
                        translate translate-attr-title="{{!btnPermission.priceSchemeAdd?'无权限执行此操作':''}}">新增</button>
                    <button class="btn btn-operate m-r-xs" ng-click="syncSap(0)"
                        ng-disabled="!btnPermission.priceSchemeSync"
                        translate translate-attr-title="{{!btnPermission.priceSchemeSync?'无权限执行此操作':''}}">同步</button>
                    <button class="btn btn-operate m-r-xs" ng-click="syncSap(1)"
                        ng-disabled="!btnPermission.priceSchemeSyncIncrement"
                        translate translate-attr-title="{{!btnPermission.priceSchemeSyncIncrement?'无权限执行此操作':''}}">增量同步</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" translate translate-attr-title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" translate translate-attr-title="配置表格列"
                            ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                    </div>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" translate translate-attr-placeholder="价格方案名称" ng-model="condition.name">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)" translate>搜索</span>
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="priceTbConf" col-fixed="true"
                set-tb-style="setFixedWidth()"></div>
            <div class="main-area" style="bottom: 15px;">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in priceTbConf.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-click="toSort(priceTbConf.tableCol, $index)"
                                        ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="priceTbConf.fixedWidth"
                                            fixed-width="tbStyle.scrollLeft"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{priceTbConf.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in priceTbConf.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-click="toSort(priceTbConf.tableCol, $index)"
                                        ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="priceTbConf.scrollWidth">
                                        </div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0" ng-style="tbStyle.scrollLeftWidth">
                        <table class="table-fixed border-none">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.cueRow}"
                                    ng-click="selectRow($index)">
                                    <td class="spill-dots border-l-none"
                                        ng-repeat="itemCol in priceTbConf.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <div class="font-0" ng-if="itemCol.type === 'operate'">
                                            <button class="btn btn-operate m-r-xs" ng-click="setClient(item.id)"
                                                ng-disabled="!btnPermission.priceSchemeSetClient"
                                                translate translate-attr-title="{{!btnPermission.priceSchemeSetClient?'无权限执行此操作':''}}">配置客户</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="editData(item)"
                                                ng-disabled="!btnPermission.priceSchemeEdit"
                                                translate translate-attr-title="{{!btnPermission.priceSchemeEdit?'无权限执行此操作':''}}">编辑</button>
                                            <button class="btn btn-operate m-r-xs" ng-click="delData(item.id)"
                                                ng-disabled="!btnPermission.priceSchemeDel"
                                                translate translate-attr-title="{{!btnPermission.priceSchemeDel?'无权限执行此操作':''}}">删除 </button>
                                            <button class="btn btn-operate m-r-xs" ng-click="importMateriel(item)"
                                                ng-disabled="!btnPermission.priceSchemeEdit"
                                                translate translate-attr-title="{{!btnPermission.priceSchemeEdit?'无权限执行此操作':''}}">导入 </button>
                                            <button class="btn btn-operate m-r-xs" ng-click="clearAllUser(item)"
                                                ng-disabled="!btnPermission.priceSchemeSetClient"
                                                translate translate-attr-title="{{!btnPermission.priceSchemeSetClient?'无权限执行此操作':''}}">一键清空所有客户</button>
                                            <button class="btn btn-operate" ng-click="configuration(item)"
                                                ng-disabled="!btnPermission.priceSchemeSetClient"
                                                translate translate-attr-title="{{!btnPermission.priceSchemeSetClient?'无权限执行此操作':''}}">一键配置所有客户</button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{priceTbConf.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.cueRow}"
                                    ng-click="selectRow($index)">
                                    <td class="spill-dots" ng-repeat="itemCol in priceTbConf.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span ng-if="!itemCol.clickFn">{{item[itemCol.dataField]}}</span>
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0" translate>暂时没有数据</div>
                </div>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="main-area d-t-35 d-b-60">
                <form name="form" class="main-wrap form-horizontal single-col p-t clearfix" novalidate>
                    <div class="form-group">
                        <label class="col-xs-5 control-label"><i>*</i><span translate>价格方案名称</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="name" class="form-control" ng-model="detailInfo.name" required
                                yb-focus maxlength="20">
                        </div>
                        <div class="col-xs-4 msg-block" ng-show="form.name.$dirty || (form.name.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.name.$error.required && !form.name.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请填写</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-5 control-label"><span translate>价格组</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="priceGroup" class="form-control" ng-model="detailInfo.priceGroup"
                                maxlength="20" ng-disabled="tabFlag.type === 1">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-5 control-label"><span translate>是否SAP同步</span>：</label>
                        <div class=" control-label text-left" translate>
                            {{!!detailInfo.isSynSap ? "是" : "否"}}
                        </div>
                    </div>
                    <!-- 增加价格类型字段 -->
                    <div class="form-group m-b-xs" ng-if="detailInfo.modeType === 0">
                        <label class="col-xs-5 control-label"><i>*</i><span translate>价格类型</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <select name="priceType" class="form-control" ng-model="detailInfo.priceType"
                             ng-options="item.id as (item.name|translate) for item in priceTypeList" required yb-focus>
                                <option value="" translate>请选择</option>
                            </select>
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.priceType.$dirty || (form.priceType.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.priceType.$error.required && !form.priceType.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请填写</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group" ng-if="tabFlag.type === 1 && !!detailInfo.isSynSap">
                        <label class="col-xs-5 control-label"><span translate>折扣类型</span>：</label>
                        <div class="col-xs-5 control-label text-left">
                            {{!!detailInfo.modeType ? "指定价格" : "固定折扣"}}
                        </div>
                    </div>
                    <div class="form-group" ng-if="!detailInfo.isSynSap">
                        <label class="col-xs-5 control-label"><i>*</i><span translate>折扣类型</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <select name="modeType" class="form-control" ng-model="detailInfo.modeType" ng-change="changeMode()"
                                ng-options="item.id as (item.name|translate) for item in priceSchemeType" required yb-focus>
                                <option value="" translate>请选择</option>
                            </select>
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.modeType.$dirty || (form.modeType.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.modeType.$error.required && !form.modeType.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请填写</span>
                            </div>
                        </div>
                    </div>
                    <div class="advance-search m-t-sm" style="padding-left:28.5rem;" ng-if="detailInfo.modeType == 0">
                        <div class="form-group clearfix">
                            <label class="col-xs-5 control-label"><span translate>零件分类</span>：</label>
                            <div ng-model="detailInfo" materiel-class-selector clean-icon="true" class="lh-12-16"></div>
                        </div>
                    </div>
                    


                    <div class="form-group">
                        <label class="col-xs-5 control-label"><i ng-if="isJCHK">*</i><span translate>币种</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="currency" class="form-control" ng-model="detailInfo.currency" ng-required="isJCHK"
                                yb-focus maxlength="20">
                        </div>
                        <div class="col-xs-4 msg-block" ng-show="form.currency.$dirty || (form.currency.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.currency.$error.required && !form.currency.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请填写</span>
                            </div>
                        </div>
                    </div>                    
                    <div class="form-group m-b-xs" ng-if="detailInfo.modeType === 0">
                        <label class="col-xs-5 control-label"><i>*</i><span translate>活动折扣</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="modeRate" class="form-control" ng-model="detailInfo.modeRate"
                                ng-if="detailInfo.priceType===0||detailInfo.priceType===2" yb-number-input disable-decimal="false"
                                decimal-places="4" min="0" required yb-focus>
                            <input type="text" name="modeRate" class="form-control" ng-model="detailInfo.modeRate"
                                ng-if="detailInfo.priceType===1 && !isJCHK" yb-number-input disable-decimal="false"
                                decimal-places="4" min="1" required yb-focus>
                            <input type="text" name="modeRate" class="form-control" ng-model="detailInfo.modeRate"
                                ng-if="detailInfo.priceType===1 && isJCHK" yb-number-input disable-decimal="false"
                                decimal-places="4" min="0" required yb-focus>                                
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.modeRate.$dirty || (form.modeRate.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.modeRate.$error.required && !form.modeRate.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请填写</span>
                            </div>
                        </div>
                    </div>


                    <!--增加价格方案类型 add by lqx schemeType-->
                    <div class="form-group m-b-xs" ng-if="isWJ">
                        <label class="col-xs-5 control-label"><i>*</i><span translate>方案类型</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <select name="schemeType" class="form-control" ng-model="detailInfo.schemeType"
                            ng-options="item.id as (item.name|translate) for item in schemeTypeList" required yb-focus>
                                <option value="" translate>请选择</option>
                            </select>
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.schemeType.$dirty || (form.schemeType.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.schemeType.$error.required && !form.schemeType.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请填写</span>
                            </div>
                        </div>
                    </div>
                    <!----->

                    <div class="form-group m-b-none" ng-if="detailInfo.modeType === 0 && (detailInfo.priceType===0||detailInfo.priceType===2)">
                        <label class="col-xs-5 control-label"></label>
                        <label class="col-xs-5 wrapper-none text-left disable-color" translate>请输入0以上的数字</label>
                    </div>
                    <div class="form-group m-b-none" ng-if="detailInfo.modeType === 0 && detailInfo.priceType===1 && !isJCHK">
                        <label class="col-xs-5 control-label"></label>
                        <label class="col-xs-5 wrapper-none text-left disable-color" translate>请输入1以上的数字</label>
                    </div>
                    <div class="form-group m-b-none" ng-if="detailInfo.modeType === 0 && detailInfo.priceType===1 && isJCHK">
                        <label class="col-xs-5 control-label"></label>
                        <label class="col-xs-5 wrapper-none text-left disable-color" translate>请输入0以上的数字</label>
                    </div>                    
                    <div class="form-group">
                        <label class="col-xs-5 control-label"><span translate>生效时间</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="validDateStart" class="form-control date-picker cursor-pointer"
                                ng-model="detailInfo.validDateStart" datepicker-popup="{{'yyyy-MM-dd'}}"
                                ng-click="showDatepickerStart = !showDatepickerStart"
                                ng-change="checkDate(detailInfo, 'validDateStart', 'validDateEnd')"
                                is-open="showDatepickerStart" close-text="关闭" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-5 control-label"><span translate>失效时间</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="validDateEnd" class="form-control date-picker cursor-pointer"
                                ng-model="detailInfo.validDateEnd" datepicker-popup="{{'yyyy-MM-dd'}}"
                                ng-click="showDatepickerEnd = !showDatepickerEnd"
                                ng-change="checkDate(detailInfo, 'validDateStart', 'validDateEnd')"
                                is-open="showDatepickerEnd" close-text="关闭" readonly>
                        </div>
                    </div>
                    <div class="form-group m-b-xs">
                        <label class="col-xs-5 control-label"><span translate>状态</span>：</label>
                        <label class="col-xs-5 control-label p-l-n text-left">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.state" value="1"
                                yb-radio-name="启用">
                            <input type="radio" class="m-r-md pull-left" yb-radio ng-model="detailInfo.state" value="0"
                                yb-radio-name="禁用">
                        </label>
                    </div>
                    <div class="form-group" ng-if="detailInfo.modeType == 0" >
                        <label class="col-xs-5 control-label"><span translate>应用所有零件</span>：</label>
                        <div class="col-xs-5 wrapper-none">
                            <select name="modeType" class="form-control" ng-model="detailInfo.isAllMaterials" ng-disabled="isAllDisabled || detailInfo.materialsType">
                                <option value="1" translate>是</option>
                                <option value="0" translate>否</option>
                            </select>
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.modeType.$dirty || (form.modeType.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.modeType.$error.required && !form.modeType.focused">
                                <i class="yb-icon ico-times-circular"></i><span translate>必填项，请填写</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-xs-5 control-label">应用特定零件：</label>
                        <div class="col-xs-2 wrapper-none m-r-sm">
                            <div dealer-dictionary-selector ng-model="detailInfo.sapPurchaseType" sel-key="SAP_PUR_TYPE" option-changed="changeMat()">
                                <input type="text" name="sapPurchaseType" class="form-control light-bg"
                                    ng-model="detailInfo.sapPurchaseType" placeholder="请选择"  readonly yb-focus>
                            </div>
                        </div>
                        <div class="col-xs-2 wrapper-none m-r-sm">
                            <div dealer-dictionary-selector ng-model="detailInfo.sapMrpCon" sel-key="MRPC" option-changed="changeMat()">
                                <input type="text" name="sapMrpCon" class="form-control light-bg"
                                    ng-model="detailInfo.sapMrpCon" placeholder="请选择"  readonly yb-focus>
                            </div>
                        </div>
                        <div class="col-xs-2 wrapper-none">
                            <div dealer-dictionary-selector ng-model="detailInfo.sapAttrDes" sel-key="WLMS" option-changed="changeMat()">
                                <input type="text" name="sapAttrDes" class="form-control light-bg"
                                    ng-model="detailInfo.sapAttrDes" placeholder="请选择"  readonly yb-focus>
                            </div>
                        </div>
                    </div>

                    <div class="form-group save-bar m-b-none">
                        <label class="col-xs-5 control-label"></label>
                        <div class="col-xs-5 wrapper-none">
                            <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(form.$valid)" translate>
                                保存
                            </button>
                            <button type="button" class="btn btn-default" ng-click="changeTab(0)" translate>取消</button>
                        </div>
                    </div>
                    <div class="form-group m-b-xs" ng-if="tabFlag.type === 0">
                        <label class="col-xs-2 control-label"></label>
                        <label class="col-xs-5 control-label p-l-n text-left">
                            <div yb-check-box yb-checked="config.client" yb-check-name="新增成功后配置客户"></div>
                        </label>
                    </div>
                </form>
            </div>
        </div>
        <div tab heading="配置客户" active="activeFlag[2]" ng-if="activeFlag[2]">
            <div yb-shuttle-box ng-model="shuttleConf" call-back="handleSaveOrRemoveDealer"></div>
            <div class="bottom-area btn-bar text-center border-t clearfix">
                <button type="button" class="btn btn-default" ng-click="changeTab(0)" translate>取消</button>
            </div>
        </div>
    </div>
</div>